(function () {
    'use strict';

    angular.module('KingAdmin.pages.pdev.devopt', [])
        .config(routeConfig);

    /** @ngInject */
    function routeConfig($stateProvider) {
        $stateProvider
            .state('pdev.devopt', {
                url: '/devopt',
                templateUrl: 'app/pages/pdev/devopt/devoptlist.html',
                controller: 'DevoptListCtrl',
                controllerAs: 'kt',
                title: '设备指令控制',
                sidebarMeta: {
                    order: 2,
                },
            }).state('pdev.devopt.edit', {
            url: '/edit/:id',
            title: '编辑指令控制',
            onEnter: ['$stateParams', '$state', '$uibModal', function ($stateParams, $state, $uibModal) {
                $uibModal.open({
                    templateUrl: 'app/pages/pdev/devopt/devopt.html',
                    controller: 'DevoptCtrl',
                    controllerAs: 'kt',
                    backdrop: 'static',
                    size: 'lg'
                }).result.then(function () {
                    $state.go('pdev.devopt', null, {reload: true});
                }, function () {
                    $state.go('^');
                });
            }]
        }).state('pdev.devopt.add', {
            url: '/add/:id?isAdd',
            title: '新增指令控制',
            onEnter: ['$stateParams', '$state', '$uibModal', function ($stateParams, $state, $uibModal) {
                $uibModal.open({
                    templateUrl: 'app/pages/pdev/devopt/devopt.html',
                    controller: 'DevoptCtrl',
                    controllerAs: 'kt',
                    backdrop: 'static',
                    size: 'lg'
                }).result.then(function () {
                    $state.go('pdev.devopt', null, {reload: true});
                }, function () {
                    $state.go('^');
                });
            }]
        }).state('pdev.devopt.view', {
            url: '/view/:id?isView',
            title: '查看指令控制',
            onEnter: ['$stateParams', '$state', '$uibModal', function ($stateParams, $state, $uibModal) {
                $uibModal.open({
                    templateUrl: 'app/pages/pdev/devopt/devopt.html',
                    controller: 'DevoptCtrl',
                    controllerAs: 'kt',
                    backdrop: 'static',
                    size: 'lg'
                }).result.then(function () {
                    $state.go('pdev.devopt', null, {reload: true});
                }, function () {
                    $state.go('^');
                });
            }]
        });;
    }

})();